﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Zero.UControl.Demo.Views
{
    /// <summary>
    /// TriangleLoading3.xaml 的交互逻辑
    /// </summary>
    public partial class TriangleLoading3 : UserControl
    {
        public TriangleLoading3()
        {
            InitializeComponent();
        }

        public double CurrentValue
        {
            get { return (double)GetValue(CurrentValueProperty); }
            set { SetValue(CurrentValueProperty, value); }
        }

        public static readonly DependencyProperty CurrentValueProperty =
            DependencyProperty.Register("CurrentValue", typeof(double), typeof(TriangleLoading3), new PropertyMetadata(0.0, OnCurrentValueChanged));

        private static void OnCurrentValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            double newValue = (double)e.NewValue;
            (d as TriangleLoading3)?.UpdateProgress(newValue);
        }


        private void UpdateProgress(double progress)
        {
            ProgressText1.Text = progress.ToString("N0") + "%";
            ProgressText2.Text = progress.ToString("N0") + "%";
        }
    }
}
